#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==================================================
# @File    : case_status
# @IDE     : PyCharm
# @Author  : liuxiangui
# @Date    : 2024/2/3 15:54
# @Describe: 
# ==================================================
import json
from jsonpath import jsonpath


class CaseStatusPackages:
    def __init__(self, file_path: str):
        with open(file_path, 'r', encoding='utf-8') as f:
            content = f.read()
        self._packagesData = json.loads(content)

    @property
    def fail_cases(self):
        cases = jsonpath(self._packagesData, "$...children[?(@.status=='failed')].name")
        return cases or []
